import re


def is_placeholder(text):
    pattern = r"__[A-Z][A-Z0-9]*_PLACEHOLDER__"
    return bool(re.fullmatch(pattern, text))


def extract_placeholders(text):
    pattern = r"__[A-Z][A-Z0-9]*_PLACEHOLDER__"
    return re.findall(pattern, text)


def restore_placeholders(text, placeholders):
    for placeholder in placeholders:
        if "{}" in text:
            text = text.replace("{}", placeholder, 1)
        else:
            text += "\n"+placeholder
    return text
